//
//  DataClient.h
//  SXIotSDK
//
//  Created by ShimLin on 2019/7/16.
//

#import <Foundation/Foundation.h>
#import "CategoryData.h"
#import "GateWayInfo.h"
#import "DeviceInfo.h"
#import "ProfileInfo.h"
#import "RoomInfo.h"
#import "FuncInfo.h"
#import "SXSceneInfo.h"
#import "SXSceneAction.h"
#import "SXSceneCondition.h"
#import "JsDeviceConfig.h"
#import "SXPhyDevInfo.h"

NS_ASSUME_NONNULL_BEGIN

@interface DataClient : NSObject

#pragma mark 家庭数据接口
+ (NSArray<ProfileInfo*>*)getProfiles;
+ (void)addProfile:(ProfileInfo*) profileInfo;
+ (void)updateProfileName:(ProfileInfo*) profileInfo;
+ (void)setCurrentProfile:(NSString*)profileId;
+ (NSString*)getCurrentProfileId;
+ (ProfileInfo*)getCurrentProfileInfo;
+ (void)removeProfileById:(NSString*)profileId;

#pragma mark 房间数据机接口
+ (NSInteger)createRoomId;
+ (NSArray<RoomInfo*>*) getRoomInfoList;
+ (NSArray<RoomInfo*>*) getRoomInfoList:(NSString*)profileId;
+ (void)addRoom:(RoomInfo*)roomInfo;
+ (void)delRoom:(NSInteger)roomId;
+ (void)updateRoomInfo:(RoomInfo*)roomInfo;

#pragma mark 网关数据接口
+ (NSArray<GateWayInfo*>*) getGatewayData;
+ (NSArray<GateWayInfo*>*) getAllGatewayData;
+ (void)enabledGateway:(NSString*)zkId enable:(BOOL)enable;
+ (GateWayInfo*) getGatewayInfoByZkId:(NSString*)zkId;
+ (GateWayInfo*) getGatewayInfoByZkId:(NSString*)profileId zkId:(NSString*)zkId;
+ (void)removeGateway:(NSString*)zkId;
+ (void)updateGatewayInfo:(GateWayInfo*)gateWayInfo;
+ (void)addGatewayInfo:(GateWayInfo*)gateWayInfo;
+ (BOOL)isZkIdSaved:(NSString*)zkId;

#pragma mark 通用设备数据接口
+ (DeviceInfo*) getDeviceById:(NSInteger)devId;
+ (NSArray<DeviceInfo*>*) getDevices:(NSInteger)roomId isSensor:(BOOL)isSensor;
+ (NSArray<DeviceInfo*>*) getSensorDevList;
+ (NSArray<DeviceInfo*>*) getDevListByRoomId:(NSInteger)roomId;
+ (NSArray<DeviceInfo*>*) getSwitchSceneDevList;
+ (NSArray<DeviceInfo*>*) getDevListByType:(NSString*)devType;
+ (NSArray<DeviceInfo*>*) getDevListByIdList:(NSArray<NSNumber*>*)devIds zkId:(NSString*)zkId;
+ (NSArray<DeviceInfo*>*) getDevicesByZkId:(NSString*)zkId;
+ (void) updateDevConfig:(DeviceInfo*)deviceInfo;
+ (void) addDevToUsuallyUse:(NSInteger)devId zkId:(NSString*)zkId;
+ (void) removeDevFromUsuallyUse:(NSInteger)devId zkId:(NSString*)zkId;
+ (NSArray<DeviceInfo*>*) getUsuallyUseDev:(NSArray<NSString*>*)zkIdList;
+ (void) addDevice:(DeviceInfo*)deviceInfo;
    // 只在数据库层删除设备
+ (void) removeDevice:(NSInteger)devId zkId:(NSString*)zkId;

#pragma mark ZigBee红外设备数据接口
+ (NSArray<DeviceInfo*>*) getInfraredDevByGatewayId:(NSInteger)deviceId zkId:(NSString*)zkId;
+ (NSArray<DeviceInfo*>*) getInfraredDevByGatewayCode:(NSString*)deviceCode;

#pragma mark Wifi红外设备数据接口
+ (void) addInfraredGateway2:(NSString*)name zkId:(NSString*)zkId deviceCode:(NSString*)deviceCode;
+ (NSArray<DeviceInfo*>*) getInfraredGateway2List;
+ (NSArray<DeviceInfo*>*) getStudiedInfraredGateway2List;

#pragma mark =======================================
+ (NSArray<CategoryData*>*) getCategoryData:(NSString*)cateType;
+ (NSArray<FuncInfo*>*) getFuncInfoListByDeviceId:(NSInteger)deviceId zkId:(NSString*)zkId;
+ (FuncInfo*) getFuncInfoById:(NSInteger)funcId zkId:(NSString*)zkId;
+ (void) delFuncInfoById:(NSInteger)funcId zkId:(NSString*)zkId;
+ (void) addFuncInfoList:(NSArray<FuncInfo*>*)funcInfos;
+ (void) addFuncInfo:(FuncInfo*)funcInfo;
+ (void) updateFuncInfo:(FuncInfo*)funcInfo;
+ (int) getFuncMaxItemIndex:(NSInteger)deviceId zkId:(NSString*)zkId;
+ (void) initSdkData;

+ (void)saveScene:(SXSceneInfo*)sceneInfo callback:(void(^)(NSString* result, NSError* error))callback;
+ (NSArray<SXSceneInfo*>*)getSceneList;
+ (NSArray<SXSceneAction*>*)getSceneActionBySceneId:(NSInteger)sceneId zkId:(NSString*)zkId;
+ (void) saveSceneActionList:(NSArray<SXSceneAction*>*)sceneActionList;
+ (NSArray<SXSceneCondition*>*)getSceneConditionBySceneId:(NSInteger)sceneId zkId:(NSString*)zkId;
+ (void)saveSceneConditionList:(NSArray<SXSceneCondition*>*)sceneConditionList sceneId:(NSInteger)sceneId callback:(void(^)(NSString* result, NSError* error))callback;
+ (NSInteger)delScene:(NSInteger)sceneId zkId:(NSString*)zkId;
+ (void)delSceneConditionByIds:(NSArray<NSNumber*>*) idList zkId:(NSString*)zkId;
+ (SXSceneCondition*)getSceneConditionById:(NSInteger)conditionId zkId:(NSString*)zkId;
+ (JsDeviceConfig*)getDevJsConfigByDevType:(NSString*)deviceType;
+ (NSArray<NSString*>*)getDevRunConfigByDevType:(NSString*)deviceType;
+ (NSDictionary<NSString*, NSArray<NSString*>*>*)getDevShowConfigByDevType:(NSString*)deviceType;
+ (NSArray<SXPhyDevInfo*>*)getPhyDevList:(NSString*)zkId;
+ (void)disablePhyDevRoute:(NSArray<NSNumber*>*)routeArr deviceCode:(NSString*)deviceCode;
+ (void)enablePhyDevRoute:(NSArray<NSNumber*>*)routeArr deviceCode:(NSString*)deviceCode;
+ (void)resetToFactory;
+ (void)configCopy:(NSString*)fromZkId toZkId:(NSString*)toZkId;
+ (void)updateDevList:(NSArray<DeviceInfo*>*)deviceInfoList;

#pragma mark ios 之前的接口
+ (void)removeAllTables;
+(void)saveFunInfoList:(NSArray<FuncInfo*>*)funcInfos;
+(DeviceInfo *)getLastInsertDataForDevice;

@end

NS_ASSUME_NONNULL_END
